//
//  LZLoginRegisterViewController.m
//  百思不得姐
//
//  Created by 郝庆 on 16/5/13.
//  Copyright © 2016年 haoqing. All rights reserved.
//

#import "LZLoginRegisterViewController.h"

@interface LZLoginRegisterViewController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *leftMargin;

@end

@implementation LZLoginRegisterViewController

/**
 *  点击注册账号
 */
- (IBAction)registerAccount:(UIButton *)button {
    
    [self.view endEditing:YES];
    
    if (self.leftMargin.constant == 0) { //目前显示的是登录界面
        
        self.leftMargin.constant = - self.view.lz_width;
        [button setTitle:@"已有账号？" forState:UIControlStateNormal];
        
    }else{ //目前显示的是注册界面
        
        self.leftMargin.constant = 0;
        [button setTitle:@"注册账号" forState:UIControlStateNormal];
        
    }
    
    [UIView animateWithDuration:0.25 animations:^{
        //强制刷新，让最新设置的约束值马上应用到UI控件上，会刷新到self.view内部的所有子控件
        [self.view layoutIfNeeded];
    }];
    
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
    
}

// 状态栏颜色
- (UIStatusBarStyle)preferredStatusBarStyle
{
    return  UIStatusBarStyleLightContent;
}

- (IBAction)back {
    [self.view endEditing:YES];
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
